package com.hainatong.shiphelper.mainhome.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder;
import com.hainatong.shiphelper.R;
import com.hainatong.shiphelper.databinding.ItemFunctionViewBinding;
import com.hainatong.shiphelper.mainhome.entity.FunctionEntity;
import org.jetbrains.annotations.NotNull;

import java.util.List;

public class FunctionAdapter extends BaseQuickAdapter<FunctionEntity, BaseDataBindingHolder<ItemFunctionViewBinding>>
{
    public FunctionAdapter(List<FunctionEntity> functions)
    {
        super(R.layout.item_function_view , functions);
    }

    @Override
    protected void convert(@NotNull BaseDataBindingHolder<ItemFunctionViewBinding> dataBindingHolder, FunctionEntity functionEntity)
    {
       ItemFunctionViewBinding binding =  dataBindingHolder.getDataBinding();
       if( binding != null )
       {
           binding.setFunction( functionEntity );
           binding.executePendingBindings();
       }
    }
}
